var t = require;
var e = module;
var o = exports;
var i, n = this && this.__extends || (i = function(t, e) {
    return (i = Object.setPrototypeOf || {
        __proto__: []
    }
    instanceof Array &&
    function(t, e) {
        t.__proto__ = e
    } ||
    function(t, e) {
        for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
    })(t, e)
},
function(t, e) {
    function o() {
        this.constructor = t
    }
    i(t, e),
    t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
}),
a = this && this.__decorate ||
function(t, e, o, i) {
    var n, a = arguments.length,
    r = a < 3 ? e: null === i ? i = Object.getOwnPropertyDescriptor(e, o) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, i);
    else for (var s = t.length - 1; s >= 0; s--)(n = t[s]) && (r = (a < 3 ? n(r) : a > 3 ? n(e, o, r) : n(e, o)) || r);
    return a > 3 && r && Object.defineProperty(e, o, r),
    r
};
Object.defineProperty(o, "__esModule", {
    value: !0
});
var r = t("BoxGetView"),
s = t("HallConstant"),
l = t("HallScene"),
c = t("BroadCastMessage"),
d = t("Util"),
h = t("Global"),
p = t("StorageManager"),
u = t("BaseStorage"),
f = cc._decorator,
m = f.ccclass,
_ = f.property,
y = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.propress = null,
        e.progressLabel = null,
        e.btn = null,
        e.receiveNode = null,
        e.pfb_box = null,
        e.node_box_light = null,
        e
    }
    return n(e, t),
    e.prototype.onLoad = function() {
        this.storageKey = h.BaseStorageKey.DailyTask + this.node.name,
        this.stateKey = h.RedPointKey[h.RedPointKey.DailyTaskBoxBonus],
        p.StorageManager.setDailyTaskStorageKey(this.storageKey, this.stateKey)
    },
    e.prototype.start = function() {
        u.BaseStorage.getInt(this.stateKey, 0) ? (cc.log("BaseStorage.getInt(this.stateKey,0)" + u.BaseStorage.getInt(this.stateKey, 0)), this.btn.node.active = !1, this.receiveNode.active = !0) : (this.btn.node.active = !0, this.receiveNode.active = !1),
        this.node.scale = 0,
        cc.tween(this.node).to(.5, {
            scale: 1
        },
        {
            easing: "elasticOut"
        }).start(),
        this.progress(u.BaseStorage.getInt(this.storageKey, 0))
    },
    e.prototype.increase = function() {
        var t = u.BaseStorage.getInt(this.storageKey, 0) + 1;
        this.progress(t)
    },
    e.prototype.progress = function(t) {
        t >= 3 ? (t = 3, this.btn.interactable = !0, this.btn.node.getChildByName("video").active = !0, this.node_box_light.active = !0, d.Util.videoExposure(h.VideoTab.dim13)) : (this.btn.node.getChildByName("video").active = !1, this.node_box_light.active = !1, this.btn.interactable = !1),
        u.BaseStorage.setInt(this.storageKey, t),
        this.progressLabel.string = t + "/3",
        this.propress.progress = t / 3
    },
    e.prototype.getDateString = function() {
        return new Date().toDateString()
    },
    e.prototype.receiveClick = function() {
        c.default.getInstance().SendMessage(s.Broadcast_Func.Audio, s.Audio_ID.btn_click),
        d.Util.showRewardVideo(this.getBox.bind(this))
    },
    e.prototype.getBox = function() {
        this.btn.node.active = !1,
        this.receiveNode.active = !0,
        u.BaseStorage.setInt(this.stateKey, 1);
        var t = cc.instantiate(this.pfb_box);
        cc.find("Canvas").addChild(t, 100),
        t.getComponent(r.default).showOpenBoxView(r.Box_Type.senior, cc.find("Canvas").getComponent(l.default))
    },
    a([_(cc.ProgressBar)], e.prototype, "propress", void 0),
    a([_(cc.Label)], e.prototype, "progressLabel", void 0),
    a([_(cc.Button)], e.prototype, "btn", void 0),
    a([_(cc.Node)], e.prototype, "receiveNode", void 0),
    a([_(cc.Prefab)], e.prototype, "pfb_box", void 0),
    a([_(cc.Node)], e.prototype, "node_box_light", void 0),
    a([m], e)
} (cc.Component);
o.default = y